<!DOCTYPE html>
<html>
<head>
<title>文件上传更多属性设置</title>

<meta name="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="uploadify/js/jquery.uploadify.min.js"></script>
<link rel="stylesheet" type="text/css" href="uploadify/css/uploadify.css" />
</head>

<body>

	<div id="uploadify-queue"></div>
	<div id="mypic"><input type="file" name="pic" id="pic"></div>
	<div id="showImg"></div>

	<script type="text/javascript">
	
		// 动态创建Form表单
		$(function(){
			
			$("#mypic").uploadify({
// 				onInit: function () {                        //载入时触发，将flash设置到最小
//                				$("#mypic-queue").hide();
//                  },
				auto : true,
				swf : "uploadify/swf/uploadify.swf",
				uploader: "uploadServlet",
				buttonText : "请选择文件",
				fileObject :"pic",
				multi: true,
				queueSizeLimit : 3,
				fileTypeExts : "*.jpg;*.png;*.gif;*.bmp", // 只能上传图片
				//  上传成功
				onUploadSuccess: function(file,data){
				
					var _data = eval("("+data+")");
					if(_data.saved){
						var path = "<img src='upload/"+_data.fileName+"' style='width:20%'>";
						$("#showImg").append(path);
					}else{
						alert("文件上传失败");
					}
					
				},
				
			});
		
		});
	
	
	</script>
</body>
</html>
